<template>
    <div class="test">
        receive<br/>
        <span>receive msg:{{ msgFromSend }}</span>
    </div>
</template>

<script>
    import bus from './eventBus.js';

    export default {
        name: "brother-receive",
        data() {
            return {
                msgFromSend: ''
            }
        },
        created() {
            //注意回调函数不能用function(){},因为在里面会影响this的使用
            bus.$on('share', (val)=>{
                console.log('brother-receive....', val);
                this.msgFromSend = val;
            })
        }
    }
</script>

<style scoped>
    .test {
        float: left;
        width: 50%;
        height: 250px;
        background-color: gainsboro;
    }
</style>